﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once

#include "GcmpModelInterface.h"
#include "RegenDataId.h"
#include "IDbObject.h"

namespace gcmp {

    class IElement;
    class IGraphicsElementShape;
    

    /// \brief Element图形表达行为
    ///
    /// Element具有图形时，需要重写此接口
    FINAL_INTERFACE class GCMP_MODEL_INTERFACE_EXPORT IElementModelShape : public IDbObject
    {
        DEFINE_CAST_DERIVED(gcmp::IElementModelShape, gcmp::IDbObject);
    public:

        /// \brief 析构函数
        virtual ~IElementModelShape() {};

        static OwnerPtr<IElementModelShape> CreateDefaultBehavior(const IElement* pOwnerElement);

        /// \brief 获取Element对象的图形表达
        /// \return Element对象的图形表达
        virtual const IGraphicsElementShape* GetGraphicsElementShape() const = 0;

        /// \brief 暂时转移Element对象的图形表达，用于对图形表达进行位置、材质、样式的变换
        /// \note 临时方案，仅内部使用
        ///
        /// 图形表达调整完成后，再通过SetGraphicsElementShape函数设置回去,不适用于计算器计算出来的图形表达
        /// \return Element对象的图形表达
        virtual OwnerPtr<IGraphicsElementShape> TransferGraphicsElementShape() = 0;

        /// \brief 设置Element对象的图形表达
        /// \param pGraphicsElementShape Element对象的图形表达
        /// \return true：设置成功；false：设置失败
        virtual bool SetGraphicsElementShape(OwnerPtr<IGraphicsElementShape> pGraphicsElementShape) = 0;

        /// \brief 获得Element图形表达关联更新变化Id
        /// \return Element图形表达关联更新变化Id
        virtual RegenDataId GetGraphicsElementShapeRdId() const = 0;

        /// \brief 标记Element图形表达关联更新变化Id
        /// \return void
        virtual void MarkGraphicsElementShapeRdId() = 0;

    public:
        /// \brief 设置该行为所属Element
        /// \param pOwnerElement 所属Element
        /// \return bool
        virtual bool SetOwnerElement(IElement* pOwnerElement) = 0;

        /// \brief 获得该行为所属的Element
        /// \return 所属的Element
        virtual IElement* GetOwnerElement() = 0;

        /// \brief 获得该行为所属的Element
        /// \return 所属的Element
        virtual const IElement* GetOwnerElement() const = 0;
    };
}// namespace gcmp


